package net.chathu.airgw.packets.gw.serverpackets 
{
	import net.chathu.airgw.util.StringUtil;
	/**
	 * ...
	 * @author ze
	 */
	public class PrivMsgPacket implements ISendableIRCPacket 
	{
		private var _userHost:String;
		private var _target:String;
		private var _message:String;

		public function PrivMsgPacket(userHost:String, target:String, message:String) {

			_userHost = userHost;
			_target = target;
			//_message = message;
			_message=StringUtil.trim(message);
			_message=StringUtil.replaceAll(_message,"\r", "");
			_message = StringUtil.replaceAll(_message,"\n", "");
			
			//TODO: fix this!
			_message=StringUtil.replaceAll(_message,"&&", "&"); 
		}
		
		public function getMessage():String	{
			return ":" + _userHost + " PRIVMSG " + _target + " :" + _message + "\n";
			//return ":" + _userHost + " PRIVMSG " + _target + " " + _message + "\n";
		}
		
		
	}

}